#include <bits/stdc++.h>
using namespace std;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
using ll = long long;
const int N = 500010;
ll a[N], sum[N];

void solve()
{
    ll n;
    cin >> n;

    for (ll i = 1; i <= n; i++)
    {
        cin >> a[i];
        sum[i] = sum[i - 1] + a[i];
    }

    ll cnt = (n - 2) / 2;
    ll l = 1, r = n;
    ll ans2 = 0, ans1 = 0;
    for (ll k = 0; k <= cnt; k++)
    {
        ll s = sum[k] + sum[n] - sum[n - cnt + k];
        if (s > ans2)
        {
            ans2 = s;
            l = k + 1, r = n - cnt + k;
        }
    }
    ans1 = sum[r] - sum[l-1];
    cout << ans1 << " " << ans2 << endl;
}
int main()
{
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
